package com.sihai.ehr.service.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.text.MessageFormat;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Service;

import com.sihai.core.DataAccessor;
import com.sihai.core.DynamicQuery;
import com.sihai.core.Limit;
import com.sihai.core.LimitedList;
import com.sihai.core.QueryCreator;
import com.sihai.core.Sorter;
import com.sihai.core.support.HibernateDataAccessor;
import com.sihai.ehr.model.biz.Auditing;
import com.sihai.ehr.model.biz.Grade;
import com.sihai.ehr.model.biz.IdentificationCard;
import com.sihai.ehr.model.biz.InterviewArrange;
import com.sihai.ehr.model.biz.InterviewFirst;
import com.sihai.ehr.model.biz.InterviewRetrial;
import com.sihai.ehr.model.biz.InviteArrange;
import com.sihai.ehr.model.sys.InviteEnum;
import com.sihai.ehr.model.sys.Organization;
import com.sihai.ehr.repository.InviteRepository;
import com.sihai.ehr.service.InterviewService;
import com.sihai.ehr.web.pojo.IdentityCardPojo;
import com.sihai.ehr.web.pojo.InterviewArrangePOJO;

/**
 * 面试服务实现
 * 
 * @author Henry-PC
 */
@Service("interviewService")
public class InterviewServiceImpl implements InterviewService {

	@Resource
	private DataAccessor dataAccessor;

	@Resource
	private InviteRepository inviteRepository;

	public InterviewArrange getInterviewArrange(Long id) {
		if (id == null || id < 0) {
			throw new RuntimeException("【传入参数非法】");
		}
		try {
			return dataAccessor.get(InterviewArrange.class, id);
		} catch (Exception e) {
			throw new RuntimeException("【异常原因：获取面试安排对象数据库发生异常】【异常说明：+" + e.getMessage() + "】【发生地点：InviteServiceImpl.getInterviewArrange;参数id=" + id + " 】");
		}
	}

	@Override
	public LimitedList<InterviewArrangePOJO> searchInterviewArranges(Long organizationId, Long dutyId, Limit limit, Sorter sorter) {

		String strSQL = "select new com.sihai.ehr.web.pojo.InterviewArrangePOJO(i.id,e.id,e.name,i.duty.id,i.duty.dutyName,i.organization.id,i.organization.fullName,i.interviewTime,i.interviewFirstResult,i.interviewRetrialResult,i.interviewResult) "
				+ "from InterviewArrange i right join i.employeeinfoBase e where e.cancel <> '1' and i.cancel <> '1' ";

		Organization organization = null;
		boolean isReadTopOrg = false;
		if (organizationId > 0) {
			try {
				organization = dataAccessor.get(Organization.class, organizationId);
				if (organization.getTopOrganization() == null) {
					isReadTopOrg = true;
				}
			} catch (Exception e) {
				return null;
			}
		}
		try {
			if (organizationId < 0) {
				return dataAccessor.findByHql(InterviewArrangePOJO.class, strSQL, null, limit, sorter);
			} else if (dutyId < 0) {
				return dataAccessor.findByHql(InterviewArrangePOJO.class, strSQL
						+ (isReadTopOrg ? "and (i.organization.topOrganization.id=" + organizationId + " or i.organization.id=?)" : " and i.organization.id=?"),
						new Object[] { organizationId }, limit, sorter);
			} else {
				return dataAccessor.findByHql(InterviewArrangePOJO.class, strSQL
						+ (isReadTopOrg ? "and (i.organization.topOrganization.id=" + organizationId + " or i.organization.id=?)" : " and i.organization.id=?")
						+ " and i.duty.id=?", new Object[] { organizationId, dutyId }, limit, sorter);
			}
		} catch (Exception e) {
			throw new RuntimeException("【异常原因：根据组织关系及职务搜索面试记录数据库发生异常," + e.getMessage() + "】【发生地点：InviteviewServiceImpl.searchInterviewArranges;参数organizationId=" + organizationId
					+ ",dutyId=" + dutyId + "】");
		}
	}

	@Override
	public LimitedList<InterviewArrangePOJO> searchInterviewArrangesTOReport(final Long organizationId, final Long dutyId, final Limit limit, Sorter sorter) {

		LimitedList<InterviewArrangePOJO> interviewArrangePOJOs = new LimitedList<InterviewArrangePOJO>();
		try {
			String sqlQuery = "select distinct i.id as id,e.id as empolyeeId,e.name,d.id as dutyId,d.duty_name ,o.id as orgId,o.full_name,i.interview_time,i.report_time,i.checkin,c.state "
					+ "from duty as d ,organization as o ,interview_arrange as i,employeeinfo_base as e  "
					+ "left OUTER join contract_sign as c on e.id=c.base_id "
					+ "where i.cancel <> '1' and i.resume_id=e.id and d.id=i.duty_id and o.id=i.organization_id";
			//
			sqlQuery += " and i.interview_result='" + InviteEnum.pass.toString() + "'";
			Organization organization = null;
			boolean isReadTopOrg = false;
			if (organizationId > 0) {
				try {
					organization = dataAccessor.get(Organization.class, organizationId);
					if (organization.getTopOrganization() == null) {
						isReadTopOrg = true;
					}
				} catch (Exception e) {
					return null;
				}
			}
			if (organizationId > 0) {
				if (isReadTopOrg) {
					sqlQuery += " and (o.top_organization_id=" + organizationId.toString() + " or o.id=" + organizationId.toString() + ")";
				} else {
					sqlQuery += " and o.id=" + organizationId.toString();
				}
			}
			if (dutyId > 0) {
				sqlQuery += " and d.id=" + dutyId.toString();
			}

			sqlQuery += "  limit " + limit.getOffset() + "," + limit.getCount();
			Session vSession = ((HibernateDataAccessor) dataAccessor).getHibernateTemplate().getSessionFactory().getCurrentSession();
			Connection vConnection = vSession.connection();
			Statement vStatement = vConnection.createStatement();
			ResultSet rs = vStatement.executeQuery(sqlQuery);

			String[] pattern = new String[] { "yyyy-MM", "yyyyMM", "yyyy/MM", "yyyyMMdd", "yyyy-MM-dd", "yyyy/MM/dd", "yyyyMMddHHmmss", "yyyy-MM-dd HH:mm:ss",
					"yyyy/MM/dd HH:mm:ss" };
			while (rs.next()) {
				InterviewArrangePOJO vPojo = new InterviewArrangePOJO();
				vPojo.setId(rs.getLong("id"));
				vPojo.setEmployeeId(rs.getLong("empolyeeId"));
				vPojo.setName(rs.getString("name"));
				vPojo.setDutyId(rs.getLong("dutyId"));
				vPojo.setDutyName(rs.getString("duty_name"));
				vPojo.setOrgId(rs.getLong("orgId"));
				vPojo.setOrgName(rs.getString("full_name"));
				vPojo.setInterviewTime(rs.getDate("interview_time"));
				vPojo.setReportTime(rs.getDate("report_time"));
				vPojo.setStatus(rs.getString("checkin") == null ? null : InviteEnum.valueOf(rs.getString("checkin")));
				vPojo.setContractStatus(rs.getString("state") == null ? 2 : rs.getLong("state"));
				interviewArrangePOJOs.add(vPojo);
			}
			rs.close();
			vStatement.close();
			vConnection.close();
			return interviewArrangePOJOs;
		} catch (Exception e) {
			throw new RuntimeException("【异常原因：根据组织关系及职务搜索面试记录数据库发生异常," + e.getMessage() + "】【发生地点：InviteviewServiceImpl.searchInterviewArranges;参数organizationId=" + organizationId
					+ ",dutyId=" + dutyId + "】");
		}
	}

	@Override
	public LimitedList<IdentityCardPojo> searchInterviewArrangesTOIdentityCard(Long organizationId, Long dutyId, Limit limit, Sorter sorter) {

		String strSQL = "select new com.sihai.ehr.web.pojo.IdentityCardPojo(c.id,i.id,i.employeeinfoBase.id,i.employeeinfoBase.name,i.duty.dutyName,i.organization.id,i.organization.fullName,i.interviewTime,i.reportTime,c.receiveState,c.dentificationCardTime) "
				+ "from IdentificationCard c right join c.interviewArrange i where i.cancel <> 1 and i.checkin='check_in' ";
		Organization organization = null;
		boolean isReadTopOrg = false;
		if (organizationId > 0) {
			try {
				organization = dataAccessor.get(Organization.class, organizationId);
				if (organization.getTopOrganization() == null) {
					isReadTopOrg = true;
				}
			} catch (Exception e) {
				return null;
			}
		}
		try {
			if (organizationId < 0) {
				return dataAccessor.findByHql(IdentityCardPojo.class, strSQL, null, limit, sorter);
			} else if (dutyId < 0) {
				return dataAccessor.findByHql(IdentityCardPojo.class, strSQL
						+ (isReadTopOrg ? " and (i.organization.topOrganization.id=" + organizationId + " or i.organization.id=?)" : " and i.organization.id=?"),
						new Object[] { organizationId }, limit, sorter);
			} else {
				return dataAccessor.findByHql(IdentityCardPojo.class, strSQL
						+ (isReadTopOrg ? " and (i.organization.topOrganization.id=" + organizationId + " or i.organization.id=?)" : " and i.organization.id=?")
						+ " and i.duty.id=?", new Object[] { organizationId, dutyId }, limit, sorter);
			}
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException("【异常原因：根据组织关系及职务搜索识别卡记录数据库发生异常," + e.getMessage() + "】【发生地点：InviteviewServiceImpl.searchInterviewArranges;参数organizationId="
					+ organizationId + ",dutyId=" + dutyId + "】");
		}
	}

	@Override
	public LimitedList<InterviewArrange> searchInterviewArranges(final InterviewArrange interviewArrange, Limit limit, Sorter sorter) {

		if (interviewArrange == null) {
			try {
				return dataAccessor.findByClass(InterviewArrange.class, limit, sorter);
			} catch (Exception e) {
				throw new RuntimeException("【异常原因：根据组织关系及职务搜索招聘申请记录数据库发生异常】【发生地点：InviteServiceImpl.searchInviteApplies;参数inviteApply为空】");
			}
		}
		return dataAccessor.findByQuery(InterviewArrange.class, new QueryCreator() {

			@Override
			public Query createQuery(Session session) {
				DynamicQuery dynamicQuery = new DynamicQuery("from InterviewArrange i where i.cancel <> 1");
				dynamicQuery.appendIfNotNull("and i.organization.id =:organization_id", "organization_id", interviewArrange.getOrganization().getId());
				dynamicQuery.appendIfNotNull("and i.duty.id =:duty_id", "duty_id", interviewArrange.getDuty().getId());
				return dynamicQuery.build(session);
			}
		}, limit, sorter);
	}

	@Override
	public void saveInterviewArrange(InterviewArrange interviewArrange) {
		if (interviewArrange == null) {
			throw new RuntimeException("【InterviewArrange对象参数异常】");
		}
		try {
			dataAccessor.saveOrUpdate(interviewArrange);
		} catch (Exception e) {
			throw new RuntimeException("【异常原因：保存面试数据库发生异常】【异常说明：" + e.getMessage() + "】【发生地点：InviteviewServiceImpl.saveInterviewArrange】");
		}
	}

	@Override
	public void removeInterviewArrange(final String interviewArrangeIds) {
		if (interviewArrangeIds == null || interviewArrangeIds.isEmpty()) {
			throw new RuntimeException("【参数异常：employeebaseinfoIds为空】");
		}
		try {
			dataAccessor.batchUpdate(new QueryCreator() {

				@Override
				public Query createQuery(Session session) {
					return session.createQuery(MessageFormat.format("update InterviewArrange i set i.cancel = 1 where id in ({0})", interviewArrangeIds));
				}
			});
		} catch (Exception e) {
			throw new RuntimeException("【异常原因：移出面试记录数据库发生异常】【异常说明：" + e.getMessage() + "】【发生地点：InviteviewServiceImpl.removeInterviewArrange】");
		}
	}

	@Override
	public InterviewFirst getInterviewFirst(final Long id) {
		if (id == null || id <= 0) {
			return null;
		}
		try {
			List<InterviewFirst> interviewFirsts = dataAccessor.findByQuery(InterviewFirst.class, new QueryCreator() {

				@Override
				public Query createQuery(Session session) {
					DynamicQuery dynamicQuery = new DynamicQuery("from InterviewFirst i where i.cancel <> 1");
					dynamicQuery.appendIfNotNull("and i.interviewArrange.id =:interview_id", "interview_id", id);
					return dynamicQuery.build(session);
				}
			}, null, null);
			if (interviewFirsts != null && interviewFirsts.size() > 0) {
				return interviewFirsts.get(0);
			} else {
				return null;
			}
		} catch (Exception e) {
			throw new RuntimeException("【异常原因：获取面试安排对象数据库发生异常】【异常说明：+" + e.getMessage() + "】【发生地点：InviteServiceImpl.getInterviewArrange;参数id=" + id + " 】");
		}
	}

	@Override
	public List<InterviewFirst> searchInterviewFirsts(Long interviewArrangeId, Limit limit, Sorter sorter) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public LimitedList<InterviewFirst> searchInterviewFirsts(InterviewFirst interviewFirst, Limit limit, Sorter sorter) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void saveInterviewFirst(InterviewFirst interviewFirst, Long dutyId, Long orgId) {
		if (interviewFirst == null || dutyId <= 0 || orgId <= 0) {
			throw new RuntimeException("［参数异常］［interviewFirst为空|dutyId|orgId为空］");
		}
		InterviewArrange interviewArrange = new InterviewArrange();
		Long arrangeId = interviewFirst.getInterviewArrange() == null ? -1 : interviewFirst.getInterviewArrange().getId();
		// 添加面试安排记录 由于流程修改，原始代码做修改
		if (arrangeId > 0) {
			// interviewArrange.setId(arrangeId); //#{1}
			interviewArrange = getInterviewArrange(arrangeId);
		}
		/*
		 * Duty vDuty = new Duty(); vDuty.setId(dutyId);
		 * 
		 * Organization vOrganization = new Organization();
		 * vOrganization.setId(orgId);
		 * 
		 * EmployeeinfoBase vEmployeeinfoWork = new EmployeeinfoBase();
		 * vEmployeeinfoWork.setId(resumeId);
		 */

		Grade vGrade = new Grade();
		vGrade.setId(interviewFirst.getGrade().getId());

		/*
		 * interviewArrange.setDuty(vDuty);
		 * interviewArrange.setOrganization(vOrganization);
		 * interviewArrange.setEmployeeinfoBase(vEmployeeinfoWork);
		 */
		interviewArrange.setGrade(vGrade);
		InviteEnum firstViewEnum = InviteEnum.unpass;
		if (interviewFirst.getAppraiseResult() == InviteEnum.retrial_exam || interviewFirst.getAppraiseResult() == InviteEnum.advice_job) {
			firstViewEnum = InviteEnum.pass;
		} else if (interviewFirst.getAppraiseResult() == InviteEnum.deleted_directly) {
			interviewArrange.setCancel(true); // 删除标识
		}

		// 设置初试人员
		// interviewArrange.setInterviewFirst(null);
		interviewArrange.setInterviewFirstResult(firstViewEnum);
		if (interviewFirst.getAppraiseResult() == InviteEnum.deleted_directly) {
			interviewArrange.setInterviewResult(InviteEnum.out);
		} else if (firstViewEnum == InviteEnum.unpass) {
			interviewArrange.setInterviewResult(InviteEnum.out);
		} else {
			interviewArrange.setInterviewResult(InviteEnum.viewing);
		}
		interviewArrange.setInterviewTime(new Date(System.currentTimeMillis()));
		// 添加招聘安排
		saveInterviewArrange(interviewArrange);
		interviewFirst.setInterviewArrange(interviewArrange);

		try {
			// 添加初试结果
			dataAccessor.saveOrUpdate(interviewFirst);

			// 处理招聘安排流程
			List<InviteArrange> inviteArranges = inviteRepository.queryInviteArranges(orgId, dutyId, null, null, null);
			if (inviteArranges != null) {
				for (InviteArrange inviteArrange : inviteArranges) {
					inviteArrange.setInviteResult(InviteEnum.in);
					inviteRepository.saveInviteArrange(inviteArrange);
				}
			}

		} catch (Exception e) {
			throw new RuntimeException("【异常原因：保存初试结果到数据库发生异常】【异常说明：" + e.getMessage() + "】【发生地点：InviteviewServiceImpl.saveInterviewFirst】");
		}

	}

	@Override
	public void removeInterviewFirsts(String interviewFirstIds) {
		// TODO Auto-generated method stub

	}

	@Override
	public InterviewRetrial getInterviewRetrial(final Long id) {
		if (id == null || id <= 0) {
			return null;
		}
		try {
			List<InterviewRetrial> interviewRetrials = dataAccessor.findByQuery(InterviewRetrial.class, new QueryCreator() {

				@Override
				public Query createQuery(Session session) {
					DynamicQuery dynamicQuery = new DynamicQuery("from InterviewRetrial i where i.cancel <> 1");
					dynamicQuery.appendIfNotNull("and i.interviewArrange.id =:interview_id", "interview_id", id);
					return dynamicQuery.build(session);
				}
			}, null, null);
			if (interviewRetrials != null && interviewRetrials.size() > 0) {
				return interviewRetrials.get(0);
			} else {
				return null;
			}
		} catch (Exception e) {
			throw new RuntimeException("【异常原因：获取复试对象数据库发生异常】【异常说明：+" + e.getMessage() + "】【发生地点：InviteServiceImpl.getInterviewRetrial;参数id=" + id + " 】");
		}
	}

	@Override
	public List<InterviewRetrial> searchInterviewRetrials(Long interviewArrageId, Limit limit, Sorter sorter) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public LimitedList<InterviewRetrial> searchInterviewRetrials(InterviewRetrial interviewRetrial, Limit limit, Sorter sorter) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void saveInterviewRetrial(InterviewRetrial interviewRetrial, Long dutyId, Long orgId) {
		if (interviewRetrial == null || dutyId <= 0 || orgId <= 0) {
			throw new RuntimeException("［参数异常］［interviewRetrial为空|dutyId|orgId为空］");
		}
		InterviewArrange interviewArrange = getInterviewArrange(interviewRetrial.getInterviewArrange().getId());
		if (interviewRetrial.getAppraiseResult() == InviteEnum.turn_pool) {
			// interviewArrange.setInterviewResult(InviteEnum.unpass);
			interviewArrange.setInterviewResult(InviteEnum.out);
		} else if (interviewRetrial.getAppraiseResult() == InviteEnum.deleted_directly) {
			interviewArrange.setInterviewResult(InviteEnum.out);
			interviewArrange.setCancel(true);
		} else {
			interviewArrange.setInterviewResult(InviteEnum.pass);
			interviewArrange.setReportTime(interviewRetrial.getRegisterDate());
		}

		InviteEnum retrialViewEnum = InviteEnum.unpass;
		if (interviewRetrial.getAppraiseResult() == InviteEnum.own_appointment || interviewRetrial.getAppraiseResult() == InviteEnum.advice_job) {
			retrialViewEnum = InviteEnum.pass;
		}
		// 设置复试人员
		// interviewArrange.setInterviewRetrial(null);
		interviewArrange.setInterviewRetrialResult(retrialViewEnum);

		// 更新面试安排表
		// @henry{---> 由于不在同一个职级下需要更新组织 2013-06-14需要更改
		if(interviewRetrial.getAppraiseResult() == InviteEnum.advice_job){
			interviewArrange.setOrganization(interviewRetrial.getGradeAdvice().getDuty().getOrganization());
			interviewArrange.setDuty(interviewRetrial.getGradeAdvice().getDuty());
			interviewArrange.setGrade(interviewRetrial.getGradeAdvice());
		}else{
			if(interviewRetrial.getGradeGive() != null && interviewRetrial.getGradeGive().getDuty() != null){
				interviewArrange.setGrade(interviewRetrial.getGradeGive());
			}else{
				interviewArrange.setOrganization(interviewRetrial.getGradeGive().getDuty().getOrganization());
				interviewArrange.setDuty(interviewRetrial.getGradeGive().getDuty());
				interviewArrange.setGrade(interviewRetrial.getGradeGive());
			}
		}
		// @}
		saveInterviewArrange(interviewArrange);

		// 保存复试结果
		try {
			dataAccessor.saveOrUpdate(interviewRetrial);

			// 处理招聘安排流程
			List<InviteArrange> inviteArranges = inviteRepository.queryInviteArranges(orgId, dutyId, null, null, null);
			if (inviteArranges != null) {
				for (InviteArrange inviteArrange : inviteArranges) {

					if (retrialViewEnum == InviteEnum.pass) {
						if (inviteArrange.getCompleteNum() + 1 < inviteArrange.getInviteApply().getApplyAmount()) {
							inviteArrange.setCompleteNum(inviteArrange.getCompleteNum() + 1);
						} else {
							inviteArrange.setCompleteNum(inviteArrange.getCompleteNum() + 1);
							inviteArrange.setInviteResult(InviteEnum.completed);
						}
						inviteRepository.saveInviteArrange(inviteArrange);
					}
				}
			}
		} catch (Exception e)

		{
			throw new RuntimeException("【异常原因：保存复试结果到数据库发生异常】【异常说明：" + e.getMessage() + "】【发生地点：InviteviewServiceImpl.saveInterviewRetrial】");
		}

	}

	@Override
	public void removeInterviewRetrial(String interviewRetrialIds) {
		// TODO Auto-generated method stub

	}

	@Override
	public Auditing getAuditing(Long id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Auditing> searchAuditings(Long interViewArrageId, Limit limit, Sorter sorter) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public LimitedList<Auditing> searchAuditings(Auditing auditing, Limit limit, Sorter sorter) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void saveAuditing(Auditing auditing) {
		// TODO Auto-generated method stub

	}

	@Override
	public void removeAuditing(String auditingIds) {
		// TODO Auto-generated method stub

	}

	@Override
	public IdentificationCard queryIdentityCardByEmployeeId(final Long id, final Long arrangeId) {
		if (id <= 0) {
			throw new RuntimeException("［参数异常］");
		}
		try {
			List<IdentificationCard> list = dataAccessor.findByQuery(IdentificationCard.class, new QueryCreator() {

				@Override
				public Query createQuery(Session session) {
					DynamicQuery dynamicQuery = new DynamicQuery("from IdentificationCard i where 1=1");
					dynamicQuery.appendIfNotNull("and i.employeeinfoBase.id =:employee_id", "employee_id", id);
					dynamicQuery.appendIfNotNull("and i.interviewArrange.id =:arrange_id", "arrange_id", arrangeId);
					return dynamicQuery.build(session);
				}
			}, null, null);
			if (list != null && list.size() > 0) {
				return list.get(0);
			} else {
				return null;
			}
		} catch (Exception e) {
			throw new RuntimeException("【异常原因：查询识别卡数据库发生异常】【异常说明：" + e.getMessage() + "】【发生地点：InviteviewServiceImpl.queryIdentityCardByEmployeeId】");
		}
	}

	@Override
	public IdentificationCard queryIdentityCardByViewArrangeId(final Long id) {
		if (id <= 0) {
			throw new RuntimeException("［参数异常］");
		}
		try {
			List<IdentificationCard> list = dataAccessor.findByQuery(IdentificationCard.class, new QueryCreator() {

				@Override
				public Query createQuery(Session session) {
					DynamicQuery dynamicQuery = new DynamicQuery("from IdentificationCard i where 1=1");
					dynamicQuery.appendIfNotNull("and i.interviewArrange.id =:arrange_id", "arrange_id", id);
					return dynamicQuery.build(session);
				}
			}, null, null);
			if (list != null && list.size() > 0) {
				return list.get(0);
			} else {
				return null;
			}
		} catch (Exception e) {
			throw new RuntimeException("【异常原因：查询识别卡数据库发生异常】【异常说明：" + e.getMessage() + "】【发生地点：InviteviewServiceImpl.saveInterviewRetrial】");
		}
	}

	public void saveIdentificationCard(IdentificationCard identificationCard) {
		if (identificationCard == null) {
			throw new RuntimeException("【identificationCard对象参数异常】");
		}
		try {
			dataAccessor.saveOrUpdate(identificationCard);
		} catch (Exception e) {
			throw new RuntimeException("【异常原因：保存识别卡信息到数据库发生异常】【异常说明：" + e.getMessage() + "】【发生地点：InviteviewServiceImpl.queryIdentityCardByViewArrangeId】");
		}
	}
}
